package com.banmoon.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * 学校
 */
public class University extends OrganizationComponent{

    private List<OrganizationComponent> orgList = new ArrayList<>();

    public University(String name, String desc) {
        super(name, desc);
    }

    @Override
    public void add(OrganizationComponent component) {
        orgList.add(component);
    }

    @Override
    public void remove(OrganizationComponent component) {
        orgList.remove(component);
    }

    @Override
    public void show() {
        System.out.println("===========" + getName() + "===========");
        orgList.forEach(OrganizationComponent::show);
    }
}
